<?php 
// Register posttype
add_action( 'init', 'register_custom_posttype' );
function register_custom_posttype()
{

	$posttypes = array(
			array('posttype' => 'sliders','taxonomy' => array(),'postname'=> "Slider show",'support' => array('title','excerpt','thumbnail')),
			array('posttype' => 'dich-vu','taxonomy' => array(),'postname'=> "Dịch vụ",'support' => array('title','excerpt','editor','thumbnail')),
			array('posttype' => 'tu-van','taxonomy' => array(),'postname'=> "Tư vấn",'support' => array('title','excerpt','editor','thumbnail')),
			array('posttype' => 'tin-tuc','taxonomy' => array(),'postname'=> "Tin tức",'support' => array('title','excerpt','editor','thumbnail')),
			array('posttype' => 'khach-hang','taxonomy' => array(),'postname'=> "Khách hàng",'support' => array('title','excerpt','editor','thumbnail'))
	);
	
	
	foreach ($posttypes as $key => $value)
	{
		$labels = array(
				'name' 					=> __($value['postname'], WS24_THEMENAME),
				'singular_name' 		=> __($value['postname'], WS24_THEMENAME),
				'add_new' 				=> __("Thêm mới", WS24_THEMENAME),
				'add_new_item' 			=> __("Thêm mới".$value['postname'],WS24_THEMENAME),
				'edit_item' 			=> __('Chỉnh sửa'.$value['postname'],WS24_THEMENAME),
				'new_item' 				=> __($value['postname'].' new',WS24_THEMENAME),
				'all_items' 			=> __('Tất cả'.$value['postname'],WS24_THEMENAME),
				'view_item'				=> __('Xem'.$value['postname'],WS24_THEMENAME),
				'search_items'			=> __('Tìm kiếm'.$value['postname'],WS24_THEMENAME),
				'not_found' 			=> __('Không tìm thấy'.$value['postname'],WS24_THEMENAME),
				'not_found_in_trash' 	=> __('Không tìm thấy'.$value['postname'],WS24_THEMENAME),
				'parent_item_colon' 	=> '',
				'menu_name' 			=> __($value['postname'],WS24_THEMENAME)
	
		);
		$args = array(
				'labels' 				=> $labels,
				'public' 				=> true,
				'publicly_queryable' 	=> true,
				'show_ui' 				=> true,
				'show_in_menu' 			=> true,
				'query_var' 			=> true,
				'rewrite' 				=> true,
				'capability_type' 		=> 'post',
				'has_archive' 			=> true,
				'hierarchical' 			=> false,
				'taxonomies'			 => $value['taxonomy'],
				'menu_icon'				=> get_stylesheet_directory_uri().'/admins/images/setting_icon.jpg',
				'supports' 				=> $value['support']
		);
		register_post_type($value['posttype'],$args);
	}
	
}



function my_feed_request($qv) {	
	    if (isset($qv['feed']) && !isset($qv['post_type']))
	        $qv['post_type'] = array('post');
	    return $qv;
	}
add_filter('request', 'my_feed_request');
?>